/*
 * @Author: WangLi
 * @Date: 2024-03-19 06:04:49
 * @LastEditors: WangLi
 * @LastEditTime: 2024-05-19 07:48:12
 */
import WPage from "../../common/WPage";
import { getUuid, writeBLECharacteristicValue } from "../../utils/common";

const app = getApp();
WPage({
  data: {
    title: "固件升级",
  },
  onLoad(options) {},
  handleStart() {
    const serviceId = getUuid("5507");
    writeBLECharacteristicValue(serviceId, getUuid("0073"), "", "", (res) => {
      if (res.code === 200) {
        wx.showToast({
          title: "固件已开始升级",
          icon: "none",
        });
      } else {
        wx.showToast({
          title: "开始升级失败",
          icon: "none",
        });
      }
    });
  },
  handleUpdateMode() {
    const serviceId = getUuid("5507");
    writeBLECharacteristicValue(serviceId, getUuid("0072"), "", "设备已进入升级");
  },
});
